package br.com.fixtrader.quoteserver;

public class Worker extends Thread {

	private ThreadPool pool;

	public Worker(ThreadPool pool) {
		this.pool = pool;
	}

	@Override
	public void run() {
		while (true) {
			// blocks until job
			Runnable job = pool.getNext();
			try {
				job.run();
			} catch (Exception e) {
				// Ignore exceptions thrown from jobs
				System.err.println("Job exception: " + e);
			}
		}
	}
}
